﻿using System;
using Loki.Utils;

namespace Loki.Data
{
    public class DefaultFactory<TEntityClass> : IFactory<TEntityClass>
    {
        private Func<TEntityClass> builder;

        public DefaultFactory()
        {
            builder = ExpressionHelper.New<TEntityClass>().Compile();
        }

        public TEntityClass Create(object discriminator)
        {
            return builder();
        }
    }
}